/*** Eclipse Class Decompiler plugin, copyright (c) 2012 Chao Chen (cnfree2000@hotmail.com) ***/
package com.qihoo.gamecenter.sdk.support.component;

import android.app.Activity;
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.FrameLayout;
import android.widget.FrameLayout.LayoutParams;
import android.widget.ImageView;
import android.widget.ImageView.ScaleType;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.qihoo.gamecenter.sdk.common.d.a.a;
import com.qihoo.gamecenter.sdk.common.i.s;

public class CustomTitleBar extends FrameLayout {
    private Activity a;
    private com.qihoo.gamecenter.sdk.support.d.a b;
    private a c;
    private TextView d;

    public CustomTitleBar(Context paramContext) {
        super(paramContext);
        this.a = ((Activity) paramContext);
        a();
        b();
    }

    public CustomTitleBar(Context paramContext, AttributeSet paramAttributeSet) {
        super(paramContext, paramAttributeSet);
    }

    public void setOnBackPressedListener(a parama) {
        this.c = parama;
    }

    public void setTitle(String paramString) {
        this.d.setText(paramString);
    }

    private void a() {
        this.b = com.qihoo.gamecenter.sdk.support.d.a.a(this.a);
        this.b.a(this, -1073741769);
    }

    private void b() {
        setPadding(s.b(this.a, 6.0F), s.b(this.a, 3.0F), s.b(this.a, 6.0F), s.b(this.a, 3.0F));
        TextView localTextView1 = new TextView(this.a);
        localTextView1.setMinimumWidth(s.b(this.a, 50.0F));
        localTextView1.setTextSize(1, s.a(this.a, 13.3F));
        localTextView1.setGravity(17);
        localTextView1.setText(com.qihoo.gamecenter.sdk.common.d.a.a(a.a.dJ));
        localTextView1.setTextColor(-1);
        this.b.a(localTextView1, -1073741819, -1073741818, -1073741818);
        FrameLayout.LayoutParams localLayoutParams1 = new FrameLayout.LayoutParams(-2, s.b(this.a, 30.0F));
        addView(localTextView1, localLayoutParams1);
        localTextView1.setOnClickListener(new View.OnClickListener() {
            public void onClick(View paramView) {
                if (CustomTitleBar.a(CustomTitleBar.this) != null)
                    CustomTitleBar.a(CustomTitleBar.this).a();
                else
                    CustomTitleBar.b(CustomTitleBar.this).finish();
            }
        });
        LinearLayout localLinearLayout = new LinearLayout(this.a);
        localLinearLayout.setLayoutParams(new FrameLayout.LayoutParams(-1, -2));
        localLinearLayout.setGravity(17);
        ImageView localImageView = new ImageView(this.a);
        int i = s.b(this.a, 18.0F);
        localImageView.setLayoutParams(new FrameLayout.LayoutParams(i, i));
        localImageView.setScaleType(ImageView.ScaleType.FIT_XY);
        localImageView.setBackgroundDrawable(this.b.a(1073741867));
        localLinearLayout.addView(localImageView);
        TextView localTextView2 = new TextView(this.a);
        localTextView2.setGravity(17);
        localTextView2.setTextColor(-1);
        localTextView2.setTextSize(1, s.a(this.a, 16.0F));
        localTextView2.setText(com.qihoo.gamecenter.sdk.common.d.a.a(a.a.bS));
        this.d = localTextView2;
        localLinearLayout.addView(localTextView2);
        FrameLayout.LayoutParams localLayoutParams2 = new FrameLayout.LayoutParams(-2, s.b(this.a, 34.0F));
        localLayoutParams2.gravity = 17;
        addView(localLinearLayout, localLayoutParams2);
    }

    public static abstract interface a {
        public abstract void a();
    }
}